#ifndef DW_GRAFFITI_TEXTURE_H
#	define DW_GRAFFITI_TEXTURE_H

#include "enums.h"

namespace dw {
	namespace graffiti {

class Texture
{
public : //! @name Construction & Destruction
	//! @{
	Texture(texture::type::dimensions dimension, bool multisample, bool array)
	:	m_dimension(dimension)
	,	m_multisample(multisample)
	,	m_array(array)
	{
		glGenTextures(1, &m_id);
	}

	explicit Texture(GLint id, texture::type::dimensions dimension, bool multisample, bool array)
	:	m_id(id)
	,	m_dimension(dimension)
	,	m_multisample(multisample)
	,	m_array(array)
	{
	}

	~Texture()
	{
		glDeleteTextures(1, &m_id);
	}
	//! @}

	void bind()
	{
		glBindTexture(texture::glTarget(m_dimension, m_array, m_multisample), m_id);
	}

	void unbind()
	{
		glBindTexture(texture::glTarget(m_dimension, m_array, m_multisample), 0);
	}

public : //! @name State
	//! @{
	bool isValid() const
	{
		return m_id != 0 && glIsTexture(m_id) == GL_TRUE;
	}
	//! @}

private : //! @name Data
	//! @{
	GLuint m_id;
	texture::type::dimensions m_dimension;
	bool m_multisample;
	bool m_array;
	//! @}
};

	} // namespace graffiti
} // namespace dw

#endif // !DW_GRAFFITI_TEXTURE_H
